package com.evan.common.core.constant;

public enum PersonnelTypeEnum {

    DEFAULT(1, "全部"),CUSTOM(2, "海关人员"),ENTERPRISE(3, "企业人员");

    private int code;
    private String name;

    PersonnelTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static PersonnelTypeEnum getByCode(int code) {
        for (PersonnelTypeEnum personnelTypeEnum : values()) {
            if (personnelTypeEnum.getCode() == code) {
                return personnelTypeEnum;
            }
        }
        return null;
    }

    public static PersonnelTypeEnum getByName(String name) {
        for (PersonnelTypeEnum personnelTypeEnum : values()) {
            if (personnelTypeEnum.getName().equals(name)) {
                return personnelTypeEnum;
            }
        }
        return null;
    }
}
